package com.UnionPayCenter.coupon.service.impl;

import com.UnionPayCenter.coupon.manager.CouponManager;
import com.UnionPayCenter.coupon.service.CouponQueryService;
import com.UnionPayCenter.entity.CouponEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * @author noah
 * @since 1.0.0, 2019/09/20
 */
@Service
public class CouponQueryServiceImpl implements CouponQueryService {

    @Autowired
    private CouponManager couponManager;


    @Override
    public boolean checkCouponValidTag(Integer disTypeId) {
        CouponEntity couponEntity = couponManager.couponQuery(disTypeId);
        if(Objects.isNull(couponEntity)){
            return false;
        }
        return "1".equals(couponEntity.getValidTag());
    }
}
